package com.bj58.groupbuy.action.service.impl;

import java.util.List;

import com.bj58.groupbuy.action.db.CommonDao;
import com.bj58.groupbuy.action.db.DBConfig;
import com.bj58.groupbuy.action.model.ChinahrJob;
import com.bj58.groupbuy.action.service.ChinahrJobService;

public class ChinahrJobServiceImpl implements ChinahrJobService {
	private CommonDao comDao = new CommonDao();
	
	@Override
	public List<ChinahrJob> getAllCate1() throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT * FROM data_dict.m_common_chinahr_job");
		sql.append(" where cate1_id >0 ");
		sql.append(" GROUP BY cate1_name ");
		
		return comDao.getAllColsByVo(sql.toString(), ChinahrJob.class, DBConfig.db_131_data_bi.getIntType());
	}

	@Override
	public List<ChinahrJob> getCate2(String cate1_name) throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT * FROM data_dict.m_common_chinahr_job ");
		sql.append(" where cate2_id >0 ");
		sql.append(" and cate1_name='"+ cate1_name+"' ");
		sql.append(" GROUP BY cate2_name ");
		
		return comDao.getAllColsByVo(sql.toString(), ChinahrJob.class, DBConfig.db_131_data_bi.getIntType());
	}

	@Override
	public List<ChinahrJob> getCate3(String cate1_name, String cate2_name)
			throws Exception {
		
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT * FROM data_dict.m_common_chinahr_job ");
		sql.append(" where cate3_id >0 ");
		sql.append(" and cate1_name='"+ cate1_name+"' ");
		sql.append(" and cate2_name='"+ cate2_name+"' ");
		sql.append(" GROUP BY cate3_name ");
		
		return comDao.getAllColsByVo(sql.toString(), ChinahrJob.class, DBConfig.db_131_data_bi.getIntType());
	}

}
